package com.zhoulz.homework.chaptor02.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;

public class Util {
	public static int divide(long d, long divisor, int scale){
		return divide(d, divisor, scale, RoundingMode.HALF_UP);
	}
	public static int divide(long d, long divisor, int scale, RoundingMode roundingMode){
		return (int)new BigDecimal(d).setScale(scale).divide(new BigDecimal(divisor), roundingMode).doubleValue()*100;
	}
	public static boolean empty(String str){
		return str == null || "".equals(str); 
	}
	public static boolean empty(List<?> list){
		return list == null || list.isEmpty(); 
	}
	
}
